How to represent "{{" in a django template?

Posted by rxin on Stack Overflow See other posts from Stack Overflow or by rxin
Published on 2010-05-08T16:44:53Z Indexed on 2010/05/08 16:48 UTC
Read the original article Hit count: 234

Filed under:

I'm trying to output in bibtex format in Django and the template looks like this:

@{{ pubentry.type }{,
  author    = {{% for author in pubentry.authors.all %}{{ author.first_name }} {{ author.middle_name }} {{ author.last_name }}{% if not forloop.last %} and {% endif %}
              {% endfor %}},
  title     = {{{ pubentry.title }}},
  journal   = {{{ pubentry.journal }}}
}

The problem is with the "{{{" or "{{%". One way to go around the problem is to add a space after the first "{", but that kind of tamper the format. What's the right way to escape { in Django templates?

© Stack Overflow or respective owner

Related posts about django-templates